﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Configuration;
using Zebra.DataAccess;
using Zebra.Utility;
using Zebra.WinFramework;

using System.Threading;

namespace Zebra
{
    public static class Program
    {
       
        #region Main
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SplashScreen.ShowSplashScreen();
            Application.DoEvents();
            SplashScreen.SetStatus("Loading database...");
            System.Threading.Thread.Sleep(500);
            Repository.ConnectionString(ConfigurationManager.ConnectionStrings["ZebraConnString"].ConnectionString);
     
            //Check to see got database changes
            DatabaseUpdate databaseUpdate = new DatabaseUpdate();
            if (databaseUpdate.Run())
                databaseUpdate.CleanUp();

            SplashScreen.SetStatus("Loading system libraries...");
            System.Threading.Thread.Sleep(1000);
            SplashScreen.SetStatus("Loading system...");
            System.Threading.Thread.Sleep(300);


            Application.Run(new LoginForm());
        }
        #endregion
    }
}
